{extend name="platform/base" /} 
{block name="resources"/}
<style>
	.img{
		float:left;
		padding-left: 30px;
    	padding-top: 17px;
	}
</style>
{/block}
{block name="main"}
<section class="panel panel-default">
              <header class="panel-heading"> 商品销售明细</header>
              <div class="row text-sm wrapper">
	              <div class="col-sm-3 m-b-xs">
					<!-- 			<a href="PLATFORM_MAIN/Auth/addUser" class="btn btn-sm btn-primary"><i -->
					<!-- 				class="fa fa-plus"></i> 添加用户 </a> -->
				  </div>
				  <div class="col-sm-2">
					  <select class="input-sm form-control" id="is_refund">
	                    	<option value="3">是否存在退款</option>
	                    	<option value="1">是</option>
	                    	<option value="0">否</option>
	            	  </select>
	              </div>
	              <div class="col-sm-2">
					  <select class="input-sm form-control" id="is_issue">
	                    	<option value="3">是否结算</option>
	                    	<option value="1">是</option>
	                    	<option value="0">否</option>
	            	  </select>
	              </div>
                  <div class="col-sm-2">
                  	<div class="input-group">
						<input type="text" id="startDate" class="input-sm form-control"placeholder="请选择开始日期" onclick="WdatePicker()" />		
				  	</div>
				  </div>
				  <div class="col-sm-2">
				  	<div class="input-group">
						<input type="text" id="endDate" placeholder="请选择结束日期" class="input-sm form-control"onclick="WdatePicker()" />
				  	</div>
				  </div>
				  <div class="col-sm-1">
						<div class="input-group">
							<span class="input-group-btn">
								<button class="btn btn-sm btn-default" type="button"
									onclick="LoadingInfo(1)">搜索</button>
							</span> 
						</div>
				  </div>

              </div>
               <footer class="panel-footer bg-white no-padder">
                    <div class="row text-center no-gutter">
                      <div class="col-xs-6 b-r b-light"><img src="PLATFORM_IMG/platform1.png" class="img"><span class="h4 font-bold m-t block" id="goods_sale_num">0</span> <small class="text-muted m-b block">商品销量</small> </div>
                      <div class="col-xs-6 b-r b-light"><img src="PLATFORM_IMG/platform2.png" class="img"> <span class="h4 font-bold m-t block" id="platform_money">0</span> <small class="text-muted m-b block">平台收益</small> </div>

                    </div>
                  </footer>
              <div class="table-responsive">
                <table class="table table-striped b-t b-light text-sm">
                  <thead>
                    <tr>
                      <th width="20"><input type="checkbox"></th>
                      <th class="center">商品名称 </th>
                      <th class="center">订单编号 </th>
                      <th class="center">实付金额</th>
                      <th class="center">平台抽取比率</th>
                      <th class="center">店铺收入</th>
                      <th class="center">平台收入</th>                     
                      <th class="center">是否存在退款</th>                      
                      <th class="center">退款金额</th>
                      <th class="center">店铺扣减余额</th>
                      <th class="center">平台扣减余额</th>
                      <th class="center">创建时间</th>
                      <th class="center">是否结算</th>
                    </tr>
                  </thead>
                  <tbody id="list">
                  </tbody>
                </table>
              </div>
               {include file="platform/page" /}
            </section>
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>           
<script type="text/javascript">

$(function(){
	LoadingInfo(1);
});
//查询用户列表
function LoadingInfo(page_index) {

	var start_date = $("#startDate").val();
	var end_date = $("#endDate").val();
	var is_refund = $("#is_refund").val();
	var is_issue = $("#is_issue").val();
	$.ajax({
		type : "post",
		url : "PLATFORM_MAIN/Account/shopOrderGoodsAccountRecordsList",
		async : true,
		data : {
			"page_index" : page_index,
			"start_date":start_date,
			"end_date":end_date,
			"is_refund":is_refund,
			"is_issue":is_issue,
			"goods_id":{$goods_id}
		},
		success : function(data) {
			$("#goods_sale_num").text(data.count.goods_sale_num);
			$("#platform_money").text(data.count.platform_money);
			$("#page_count").val(data.list["page_count"]);
			$("#pageNumber a").remove();
			var html = '';
			if (data.list["data"].length > 0) {
				for (var i = 0; i < data.list["data"].length; i++) {
					html += '<tr>';
					html += '<td><input type="checkbox" name="sub" value="'+ data.list['data'][i]['id']+'"></td>';
					html += '<td class="center">' + data.list["data"][i]["goods_name"] + '</td>';
					html += '<td class="center">' + data.list["data"][i]["order_no"] + '</td>';
					html += '<td class="center">' + data.list["data"][i]["goods_pay_money"] + '</td>';
					html += '<td class="center">' + data.list["data"][i]["rate"] + '%</td>';
					html += '<td class="center">' + data.list["data"][i]["shop_money"] + '</td>';
					html += '<td class="center">' + data.list["data"][i]["platform_money"] + '</td>';
					if(data.list["data"][i]["is_refund"]){
						html += '<td class="center"><i class="fa fa-check text-success"></i></td>';
					}else{
						html += '<td class="center"><i class="fa fa-minus text-danger"></i></td>';
					}
					html += '<td class="center">' + data.list["data"][i]["refund_money"] + '</td>';
					html += '<td class="center">' + data.list["data"][i]["shop_refund_money"] + '</td>';
					
					html += '<td class="center">' + data.list["data"][i]["platform_refund_money"] + '</td>';
					html += '<td class="center">' + data.list["data"][i]["create_time"] + '</td>';
					if(data.list["data"][i]["is_issue"]){
						html += '<td class="center"><i class="fa fa-check text-success"></i></td>';
					}else{
						html += '<td class="center"><i class="fa fa-minus text-danger"></i></td>';
					}																												
					
					html += '</tr>';
				}
			} else {
				html += '<tr><th colspan="12">暂无符合条件的数据记录</th></tr>';
			}
			$("#list").html(html);
				var totalpage = $("#page_count").val();
		if (totalpage == 1) {
			changeClass("all");
		}
		var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
		$("#pageNumber").append($html);
		}
	});
}	

</script>
{/block}